/**
 * Created by yuris on 15.01.15.
 */
package InterfaceObjects {
import feathers.controls.Button;
import feathers.controls.text.BitmapFontTextRenderer;
import feathers.display.Scale9Image;
import feathers.text.BitmapFontTextFormat;
import feathers.textures.Scale3Textures;
import feathers.textures.Scale9Textures;

import flash.display.Bitmap;
import flash.filters.GlowFilter;
import flash.geom.Rectangle;

import starling.display.Image;
import starling.events.Event;
import starling.filters.BlurFilter;
import starling.filters.ColorMatrixFilter;

import starling.text.BitmapFont;
import starling.text.TextField;
import starling.textures.Texture;

public class ButtonLong extends Button {
    public static const BLUE_TYPE:String = "blue";
    public static const ORANGE_TYPE:String = "orange";
    public static const GREEN_TYPE:String = "green";
    private static var _textFormat:BitmapFontTextFormat = null;

    public function ButtonLong(colorType:String = GREEN_TYPE, useScale9Texture:Boolean = false) {
        super();

        var _texturePath:String = "Interface/Buttons/button_1_long_"+colorType;
        if(useScale9Texture){
            var _scale9texture:Scale9Textures = GraphicFactory.getScale9Textures(_texturePath);
            var _imageDefault:Scale9Image = new Scale9Image(_scale9texture);
            _imageDefault.useSeparateBatch = false
            var _imageHover:Scale9Image = new Scale9Image(_scale9texture);
            _imageHover.useSeparateBatch = false
        }


        super.defaultSkin = useScale9Texture?_imageDefault:(GraphicFactory.getImageByName(_texturePath));

        super.defaultSkin.alignPivot("left","top");

        super.hoverSkin = useScale9Texture?_imageHover:(GraphicFactory.getImageByName(_texturePath));
        super.hoverSkin.alignPivot("left","top");
        var filter:ColorMatrixFilter = new ColorMatrixFilter();
        filter.adjustBrightness(0.08)
        super.hoverSkin.filter = filter;

        super.useHandCursor = true;

        if(ButtonLong._textFormat == null){
            ButtonLong._textFormat = new BitmapFontTextFormat(TextField.getBitmapFont("ComicDB"), 20, 0xffffff, "center");
        }
        super.defaultLabelProperties.textFormat = ButtonLong._textFormat;
        super.defaultLabelProperties.useSeparateBatch = false
        //super.defaultLabelProperties.worldWrap = true;

        super._labelOffsetX = -2;
        super._labelOffsetY = -2;
    }

}
}
